package com.example.lemonhealth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.lemonhealth.dao.LoginMapper;
import com.example.lemonhealth.entity.TUser;
import com.example.lemonhealth.service.LoginService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author: Lemon
 * @Description: 登录相关接口
 * @Date: 2024/12/23 17:16
 */
@Service
public class LoginServiceImpl implements LoginService {

    @Resource
    private LoginMapper loginMapper;

    /**
     * @Author Lemon
     * @Description 登录
     * @Date 2024/12/23 17:29
     * @Param [username, password]
     * @Return java.lang.String
     */
    @Override
    public boolean isLogin(String username, String password) {
        TUser user = new TUser();
        user.setUsername(username);
        user.setPassword(password);
        TUser user1 = loginMapper.selectOne(new QueryWrapper<>(user));
        if (user1 != null) {
            return true;
        }else {
            return false;
        }
    }
}
